import { resolve } from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue2'
import Compression from 'vite-compression-plugin'

// https://vitejs.dev/config/
export default defineConfig(env => {
  console.log(env)
  return {
    resolve: {
      alias: {
        src: resolve(__dirname, 'src')
      }
    },
    plugins: [
      vue(),
      Compression()
    ],
    server: {
      host: '0.0.0.0',
      port: 3019
    },
    build: {
      sourcemap: env.mode === 'development',
      rollupOptions: {
        input: {
          main: resolve(__dirname, 'index.html'),
        }
      }
    },
    preview: {
      port: 3017
    }
  }
})
